<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>
           	 中华户外网-我的社区-我的关注
        </title>
        <jsp:include page="personcommonref.jsp"></jsp:include>
    </head>
    <body id="user">
        <div class="user_cover_bg"></div><!--user box begin-->
        <div class="user_box">
        	<%--	公共头部	 --%>
			<jsp:include page="indexHead.jsp" ></jsp:include>
			
			<%--	个人信息公共	begin --%>
			<!--banner begin-->
			<div class="banner_box">
			    <img src="../images/user_banner1.jpg" />
			</div>
			<!--banner end-->
			
			<div class="user_info_box clearfix">
				<div class="user_box_lt">
			    <div class="user_box_lt_bg"></div>
			    <div class="user_box_lt_cont">
			        <div class="user_box_lt_top">
			            <div class="user_box_lt_header">
			                <img src="${session.user.headImg }">
			                <h4>
			                	${session.user.nickName}
			                    <c:if test="${session.user.sex==1}">
			                		<img src="../images/user_focus_b.png">
			                	</c:if>
			                    <c:if test="${session.user.sex==0}">
			                		<img src="../images/user_focus_g.png">
			                	</c:if>
			                </h4>
			            </div>
			
			        </div>
			        <ul>
			            <li ><a href="personinfo.jsp">我的个人资料</a></li>
			            <li><a href="PostAction_personPost.action">我的发帖</a></li>
			            <li><a href="personreply.jsp">我的回复</a></li>
			            <li><a href="personcollect.jsp">我的收藏</a></li>
			            <li class="user_left_current"><a href="personfocus.jsp">我的关注</a></li>
			            <li><a href="personmsglist.jsp">我的消息</a></li>
			            <li><a href="personhome.jsp">我的主页</a></li>
			        </ul>
			    </div>
			</div>
			<link type="text/css" href="../css/personinfo/setup.css" rel="stylesheet">
			<script type="text/javascript" src="../js/personinfo/select.js"></script>
			<%--	个人信息公共	end  --%>
        		<c:if test="${fn:length(page.queryResult) == 0 }">
                	<div style="font-size: 16px;color:#666;line-height: 30px;text-align: center;margin-top: 50px">
                		<p>您还没有关注记录噢~</p>
                	</div>
                </c:if>
                <c:if test="${fn:length(page.queryResult) > 0 }">
                <div class="user_box_rg">
                    <div class="user_focus_title">
				        <ul id="tags">
				            <!--li class="selectTag"><a onClick="selectTag('tagContent0',this)" href="javascript:void(0)">我关注的旅友</a></li-->
				        </ul>
				    </div>
				    <div id="tagContent" class="user_focus_content">
				      <div class="tagContent selectTag" id="tagContent0">
	                      <div class="user_focus_lvyou">
			              <ul id="lvlist">
			              <c:forEach items="${page.queryResult }" var="user">
                                  <li style="width:210px">
			                      <div class="user_focus_lvyou_header"><a href="UserAction_getPersonHome?uid=${user.id }"><img src="${user.headImg }"></a></div>
			                      <div class="user_focus_lvyou_info">
			                          <h4><a href="UserAction_getPersonHome?uid=${user.id }">${user.nickName }</a></h4>
			                          <a href="UserAction_cancelFocus.action?bbsUserId=${user.id }" class="cancel" cancelid="1254516">取消关注</a>
			                      </div>
			                  </li>
			              </c:forEach>
			              </ul>
	                      </div>
	                  </div>
				  </div>
                </div>
                </c:if>
                </div><!-- footer end-->
                <script type="text/javascript">
                jQuery(document).ready(function(){
                	
                });
                
				function selectTag(showContent,selfObj){
			        // 操作标签
			        var tag = document.getElementById("tags").getElementsByTagName("li");
			        var taglength = tag.length;
			        for(i=0; i<taglength; i++){
			            tag[i].className = "";
			        }
			        selfObj.parentNode.className = "selectTag";
			        // 操作内容
			        for(i=0; j=document.getElementById("tagContent"+i); i++){
			            j.style.display = "none";
			        }
			        document.getElementById(showContent).style.display = "block";
			    }
			
			    $(function() {
			        //更多
			        $("#more").click(function () {
			            $.get('/uc/focus/nextpage?page=' + $("#page").val(), function (data) {
			                $("#page").val(data.page);
			                if (data.more == '2') {
			                    $("#more").html('没有更多啦').unbind();
			                }
			                var html = '';
			                $.each(data.list, function (infos, info) {
			                    html += '<li';
			                    if(infos%3 == 2){
			                       html += ' class="user_focus_last"';
			                    }
			                    html +='><div class="user_focus_lvyou_header"><a href="http://user.huway.com/home?uid='+info.uid
			                            +'"><img src="http://uc.huway.com/avatar.php?uid='+info.uid
			                            +'&w=140&h=140"/></a></div><div class="user_focus_lvyou_info"><h4><a href="http://user.huway.com/home?uid='+info.uid
			                            +'">'+info.nickname
			                            +'</a></h4><p>LV'+info.level
			                            +'<span>'+info.levelname
			                            +'</span></p><a href="javascript:;" class="cancel" cancelid="'+info.uid
			                            +'">取消关注</a></div></li>';
			                });
			                $("#lvlist").append(html);
			
			            });
			        });
			
			        $(document).on('click',".cancel",function(){
			            if(!confirm('确定是否删除')){
			                return false;
			            }
			            var cancelid = $(this).attr("cancelid");
			            var obj = $(this).parent().parent('li');
			            $.ajax({
			                type: "POST",
			                url: "/uc/focus/delete",
			                data:{fuid:cancelid},
			                dataType: "json",
			                success: function(data){
			                    if(data.status == 2000){
			                        obj.hide();
			                    }else{
			                        return false;
			                    }
			                }
			            });
			
			        })
			    });
                </script>
            </div>
        </div><!--user box end-->
        
        <%--	公共底部	 --%>
		<jsp:include page="indexFooter.jsp" />
		
    </body>
</html>
